package com.taotao.web;

import com.taotao.common.EUTreeNode;
import com.taotao.service.TbItemCatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/item/cat")
public class TbItemCatController {

    @Autowired
    private TbItemCatService tbItemCatService;

    /**
     * 按照parentId查询商品类目
     * @param parentId
     * @return
     */
    @RequestMapping("/list")
    @ResponseBody
    public List<EUTreeNode> getTbItemList(@RequestParam(value = "id",defaultValue = "0") long parentId){
        List<EUTreeNode> euTreeNodeList = tbItemCatService.getTbItemCatList(parentId);
        return euTreeNodeList;
    }

}
